package jse.test20160806.nestedClass;

import org.junit.Test;

import java.lang.reflect.Modifier;
import java.lang.reflect.Type;

/**
 * ${DESCRIPTION}
 *
 * @author ${user}
 * @create 2016 08 07 16:51
 */
public class NestedClassInformation {

    @Test
    public    void  test() throws ClassNotFoundException {

        Class<?> cls = Class.forName("java.awt.geom.Point2D");
        Class<?>[] classes = cls.getDeclaredClasses();
        for (Class<?> clazz : classes) {
            System.out.print("类的标准名称：" + clazz.getCanonicalName());
            System.out.print("类的修饰符：" + Modifier.toString(clazz.getModifiers()));
            Type[] interfaces = clazz.getGenericInterfaces();
            System.out.println("所有泛型借口");
            if (interfaces.length != 0) {
                for (Type type : interfaces) {
                    System.out.println("\t" + type);
                }
            } else {
                System.out.println("\t" + "空");
            }

            Type superClas = clazz.getGenericSuperclass();
            System.out.println("类的直接继承类");
            if (null != superClas) {
                System.out.println(superClas);
            } else {
                System.out.println("空");
            }
        }
    }
}
